import { request } from "../../request/index";

Page({
  data: {
    //轮播图的数组
    swiperList: [],
    //导航数组;
    cateList: [],
    //楼层的数组;
    floorList: [],
  },
  //页面开始加载就会触发
  onLoad: function (options) {
    //发送异步请求;
    this.getSwiperList();
    this.getCateList();
    this.getFloorList();
  },
  //获取轮播图数据
  getSwiperList() {
    request({
      url: "/home/swiperdata",
    }).then((res) => {
      this.setData({
        swiperList: res,
      });
    });
  },
  getCateList() {
    request({
      url: "/home/catitems",
    }).then((res) => {
      this.setData({
        cateList: res,
      });
    });
  },
  getFloorList() {
    request({
      url: "/home/floordata",
    }).then((res) => {
      console.log(res);
      this.setData({
        floorList: res,
      });
    });
  },
});
